function[ correct_count ] = mahalanobisValidation(trainingSet, testSet, display) %modus)

    if (display >0)
        disp('MAHALANOBIS DISTANCE CLASSIFICATION');
    end
   % strokes = loadStrokes(modus);
    F = dir('FeatureCombinationDefs/*.txt');
    correct_count = zeros(1,size(F, 1));
    for featureFilter = 1 : size(F, 1)
        featureFilteredTrainingSet = filterFeatures(trainingSet, ['FeatureCombinationDefs/' F(featureFilter).name]);
        featureFilteredTestSet = filterFeatures(testSet, ['FeatureCombinationDefs/' F(featureFilter).name]);
       % featureFilteredStrokes = filterFeatures(strokes, ['FeatureCombinationDefs/' F(featureFilter).name]);
        if (display >0)
            disp(['Feature combination according to file [' F(featureFilter).name ']']);
        end
        D = dir('TrainingSetDefs/*.txt');
        %for split = 1 : size(D, 1)
            %[trainingSet, testSet] = splitIntoTrainingAndTest(featureFilteredStrokes, ['TrainingSetDefs/' D(split).name]);
            
            for matmode=2:4
                correct = 0;
                [meanVecs, covarMats] = trainForMahalanobis(featureFilteredTrainingSet, matmode);
                for i = 1 : size(featureFilteredTestSet, 2)
                    result = mahalanobisClassification(featureFilteredTestSet(2:end, i), meanVecs, covarMats);
                    if result == featureFilteredTestSet(1, i)
                        correct = correct + 1;
                    end
                end
                if (display >0)
                    disp(['  Training/Test separation [' D(split).name ']: ' num2str(correct) '/' num2str(size(featureFilteredTestSet, 2)) ' -> ' num2str(correct/size(featureFilteredTestSet, 2)*100) '%']);
                end
                correct_count(matmode,featureFilter)=correct;
            end
        %end
    end
end
